<template>
  	<div id="name">
    	<div class="wl-body">
      		<div class="top"></div>
      		<div class="bdds mtpo">
        		<van-list v-model="loading" :finished="finished" @load="onLoad">
					<div class="link-item slideIn newbg" v-for="(item, k) in lslist" :key="k" @click="goto('xxxx', item)" >
            			<div class="slink defcf w95">
              				<!-- <div class="txicon"><img src="../assets/timg/txico.png" alt="" class="txicon"></div> -->
              				<div class="u-id flex1 slh">
								<span v-if="dqyy == 'en-US'">{{ item.titleEn }} </span>
								<span v-if="dqyy == 'zh-CN'" >{{ item.title }}</span>
              				</div>
              				<div class="fl1 t-right">{{ item.createTime }}</div>
            			</div>
            			<div class="slink u-ds w95">
							<div class="flex1 slh">
								<span v-if="dqyy == 'en-US'"   v-html="item.contentEn"> </span>
								<span v-if="dqyy == 'zh-CN'"   v-html="item.content"></span>
							</div>
            			</div>
            			<div class="zc-rs"><img src="../assets/timg/r.png" alt="" /></div>
          			</div>
        		</van-list>
				<div v-if="!lslist">
					<img src="../assets/timg/nodata.png" alt="" />
				</div>
      		</div>
    	</div>
  	</div>
</template>

<script>
export default {
  	name: "name",
  	data() {
		return {
			isPublish: false,
			loading: false,
			finished: false,
			pageNum: 1,
			lslist: [],
		};
	},
	mounted(){
		console.log(this.dqyy)
	},
  	computed: {
		dqyy() {
			if (this.$store.getters.language) {
				return this.$store.getters.language;
			} else {
				return "zh-CN";
			}
		},
  	},
  	methods: {
		guanbi() {
			this.$router.go(-1);
		},
    	ggqr() {
			var datas = {
				id: this.$store.getters.nameid,
				status: "0",
			};
      		this.$get({
				url: "mms-news/showNews",
				data: datas,
				callback: (data) => {
					this.$nextTick(function () {
						var show = data.data;
						if (show) {
						console.log(show);
						}
					});
				},
			});
    	},
		goto(val, t) {
			this.$router.push({ path: val });
			sessionStorage.setItem("news", JSON.stringify(t));
			this.ggqr();
		},
    	onLoad() {
			var datas = {
				pageSize: 10,
				pageNum: this.pageNum,
			};
      		this.$get({
        		url: "mms-news/getList",
        		data: datas,
				callback: (data) => {
					this.$nextTick(function () {
						var list = data.data;
						if (list) {
							if (this.pageNum > 1) {
								this.lslist = [...this.lslist, ...list];
							} else {
								this.lslist = list;
							}
							this.loading = false;
							if (list.length != 0) {
								this.pageNum++;
							} else {
								this.finished = true;
							}
						}
					});
				},
      		}).catch(() => {
        		this.$toast(this.$i18n.t("m.errordata"));
      		});
    	},
  	},
};
</script>

<style  scoped>
</style>